<?php

/* Код для создание логина, на рабочей версии не используется */
// ### AclAssistant : Community
class Action_Community_CheatLogin extends RL_Handler
{

	public function process ()
	{
		$view = NULL;

		// HACK : 2007-11-21 : lucky
		// можно поменять свою роль :)
		if ($_GET['role']) {
			$aa = $this->module->aa;
			$d_comm = $aa->getInfo();
			$community_oid = $d_comm['comity_oid']; 
			$user_oid = $d_comm['user_id']; 
			$role_name = $_GET['role']; // 'Moderator'
			$roles_ql = 'select objects where role.name = :0';
			$role = $this->ctx->store->find($roles_ql, array($role_name))->next();

			if ($role && $community_oid && $user_oid) {
				$this->ctx->db->begin();
				$model = $this->ctx->mm->getModel("User", "m");
				$status = $model->setRoleByOid($community_oid, $user_oid, $role->id);
				$this->ctx->db->end();
				if ($status) {
					$view = 'Ok';
				} else {
					$view = "What's up?";
				}
			}
		}

		$this->rh->response->setContent($view);
	} // end of function execute

}




?>
